+2000-06-09 Larry Ewing <lewing@helixcode.com>
+
+ * gdk-pixbuf/io-png.c (gdk_pixbuf__png_image_load_increment):
+ setjmp for the png error handler. It seems setting the error
+ handling functions does not avoid the jump, and so not calling
+ setjmp was causing the incremental loader to jump into lala land.
+ (gdk_pixbuf__png_image_begin_load): setjmp for error handling, I'm
+ not sure this one is actually required but the docs say it must be
+ set for every call to a png_* function.
+ Also changed the comment to reflect the fact that setting the
+ error handlers does _not_ avoid the longjmp.
+
2000-06-06 Larry Ewing <lewing@helixcode.com>
* gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done):
free_buffer, NULL);
}
-/* These avoid the setjmp()/longjmp() crap in libpng */
+/* I wish these avoided the setjmp()/longjmp() crap in libpng instead
+ just allow you to change the error reporting. */
static void png_error_callback (png_structp png_read_ptr,
png_const_charp error_msg);
/* Create the main PNG context struct */
+
lc->png_read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
lc, /* error/warning callback data */
png_error_callback,
return NULL;
}
+ if (setjmp (lc->png_read_ptr->jmpbuf)) {
+ if (lc->png_info_ptr)
+ png_destroy_read_struct(&lc->png_read_ptr, NULL, NULL);
+ g_free(lc);
+ return NULL;
+ }
+
/* Create the auxiliary context struct */
lc->png_info_ptr = png_create_info_struct(lc->png_read_ptr);
lc->max_row_seen_in_chunk = -1;
/* Invokes our callbacks as needed */
- png_process_data(lc->png_read_ptr, lc->png_info_ptr, buf, size);
+ if (setjmp (lc->png_read_ptr->jmpbuf)) {
+ return FALSE;
+ } else {
+ png_process_data(lc->png_read_ptr, lc->png_info_ptr, buf, size);
+ }
if (lc->fatal_error_occurred)
return FALSE;
fprintf(stderr, "Warning loading PNG: %s\n", warning_msg);
}
+
+
+
+